package com.sinodata.bsm.center.service.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.sinodata.bsm.center.bean.Condition;
import com.sinodata.bsm.center.bean.Page;
import com.sinodata.bsm.center.dao.impl.DimensionTypeDaoImpl;
import com.sinodata.bsm.common.vo.Dimension;
import com.sinodata.bsm.common.vo.DimensionType;

@Service
@Transactional(propagation = Propagation.NOT_SUPPORTED)
public class DimensionTypeService {

    @Autowired
    private DimensionTypeDaoImpl dimensionTypeDao;

    /**
     * 根据条件查询总数
     * 
     * @param condition
     * @return
     */
    public int getTotal(Condition condition) {
        return dimensionTypeDao.getTotal(condition);
    }

    /**
     * 新增
     * 
     * @param dimensionType
     */
    public void add(DimensionType dimensionType) {
        dimensionTypeDao.save(dimensionType);
    }

    /**
     * 分页获取维度类型
     * @param page
     * @param condition
     * @return
     */
    public Page<DimensionType> findByPage(Page<DimensionType> page, Condition condition) {
        return dimensionTypeDao.findByPage(page, condition);
    }

    /**
     * 批量删除维度类型
     * 
     * @param ids
     */
    @Transactional(propagation = Propagation.REQUIRED)
    public void delete(Long[] ids) {
        dimensionTypeDao.batchDelete(ids);
    }

    /**
     * 修改维度类型
     * @param dimension
     */
    @Transactional(propagation = Propagation.REQUIRED)
    public void update(DimensionType dimensionType) {
        dimensionTypeDao.update(dimensionType);
    }
}
